#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    int lengthOfLIS(vector<int> &nums)
    {
        vector<int> dp(nums.size(), 1);
        for (int i = 1; i < (int)nums.size(); i++)
        {
            for (int j = 0; j < i; j++)
            {
                if (nums[i] > nums[j])
                {
                    dp[i] = max(dp[i], dp[j] + 1);
                }
            }
        }
        int max = 0;
        for (int i = 0; i < (int)dp.size(); i++)
        {
            if (dp[i] > max)
            {
                max = dp[i];
            }
        }
        return max;
    }
};

int main()
{
    vector<int> nums{10, 9, 2, 5, 3, 7, 101, 18};
    Solution sol;
    cout << sol.lengthOfLIS(nums) << endl;
    return 0;
}